﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
<script type="text/javascript" src="http://libs.useso.com/js/respond.js/1.4.2/respond.min.js"></script>
<script type="text/javascript" src="http://cdn.bootcss.com/css3pie/2.0beta1/PIE_IE678.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="/assets/static/h-ui/css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="/assets/static/h-ui.admin/css/H-ui.admin.css"/>
<!-- <link type="text/css" rel="stylesheet" href="font/font-awesome.min.css"/> -->
<!--[if IE 7]>
<link href="http://www.bootcss.com/p/font-awesome/assets/css/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<title>修改密码</title>
</head>
<body>
<div class="pd-20">
  <form class="Huiform" id="loginform" action="" method="post">
    <table class="table table-border table-bordered table-bg">
      <thead>
        <tr>
          <th colspan="2">修改密码</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th class="text-r" width="30%">旧密码：</th>
          <td><input type="password" class="input-text" autocomplete="off"  placeholder="旧密码" id="password" name="password">

          </td>
        </tr>
        <tr>
          <th class="text-r">新密码：</th>
          <td><input type="password" class="input-text" autocomplete="off"  placeholder="新密码" id="newpassword" name="newpassword">

          </td>
        </tr>
        <tr>
          <th class="text-r">再次输入新密码：</th>
          <td><input type="password" class="input-text" autocomplete="off"  placeholder="确认新密码" id="newpassword2" name="newpassword2">

          </td>
        </tr>
        <tr>
          <th></th>
          <td>
			<input id="sub" class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
          </td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script> 
<!-- <script type="text/javascript" src="js/Validform_v5.3.2_min.js"></script>  -->
<script type="text/javascript" src="/assets/lib/layer/2.4/layer.js"></script> 
<script type="text/javascript" src="/assets/static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="/assets/static/h-ui.admin/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/assets/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/assets/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/assets/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript">
$(function(){
		
	$("#loginform").validate({
		rules:{			
			password:{
				required:true,
			},
			newpassword:{
				required:true,
			},
			newpassword2:{
				required:true,
				equalTo: "#newpassword"
			},												
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: "updatePassword" ,
				success: function(data){
					alert(data);
					if(data.length>2){
						layer.msg('原密码不正确！', {icon:1,time:1000});
					}else{
						if(data>0){
							layer.msg('修改成功!', {icon:1,time:1000}, function(){
		                        var index = parent.layer.getFrameIndex(window.name);
		                        parent.location.reload(); //刷新父页面
		                        parent.layer.close(index);
							});
						}else{
							layer.msg('修改失败!', {icon:2,time:1000}, function(){
		                        var index = parent.layer.getFrameIndex(window.name);
		                        parent.location.reload(); //刷新父页面
		                        parent.layer.close(index);
							});
						}
					}										
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('error!',{icon:2,time:1000});
				}
			});			
		}
	});	
});
</script>

</body>
</html>